<?php
// $Id: stormexpense.views.inc,v 1.1.2.4 2010/09/21 21:53:28 juliangb Exp $

function stormexpense_views_data() {
  $data['stormexpense']['table']['group']  = t('Storm Expense');
  $data['stormexpense']['table']['join'] = array(
    'node' => array(
      'left_field' => 'vid',
      'field' => 'vid',
    ),
  );

  $data['stormexpense']['organization_nid'] = array(
    'title' => t('Organization'),
    'help' => t('Expense -> Organization'),
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Expense -> Organization'),
    ),
  );
  
  $data['stormexpense']['organization_title'] = array(
    'title' => t('Organization'),
    'help' => t('Storm Expense: Organization (title only)'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  
  $data['stormexpense']['project_nid'] = array(
    'title' => t('Project'),
    'help' => t('Expense -> Project'),
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Expense -> Project'),
    ),
  );

  $data['stormexpense']['project_title'] = array(
    'title' => t('Project'),
    'help' => t('Storm Expense Project (title only)'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  $data['stormexpense']['task_nid'] = array(
    'title' => t('Task'),
    'help' => t('Expense -> Task'),
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Expense -> Task'),
    ),
  );

  $data['stormexpense']['task_stepno'] = array(
    'title' => t('Task Step Number'),
    'help' => t('Storm Expense Task Step Number'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  
  $data['stormexpense']['task_title'] = array(
    'title' => t('Task'),
    'help' => t('Storm Expense Task (title only)'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  
  $data['stormexpense']['ticket_nid'] = array(
    'title' => t('Ticket'),
    'help' => t('Expense -> Ticket'),
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Expense -> Ticket'),
    ),
  );

  $data['stormexpense']['ticket_title'] = array(
    'title' => t('Ticket'),
    'help' => t('Storm Expense Ticket (title only)'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  
  $data['stormexpense']['provider_nid'] = array(
    'title' => t('Provider'),
    'help' => t('Expense -> Provider'),
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Expense -> Provider'),
    ),
  );

  $data['stormexpense']['provider_title'] = array(
    'title' => t('Provider'),
    'help' => t('Storm Expense Provider (title only)'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  
  $data['stormexpense']['expensedate'] = array(
    'title' => t('Date'),
    'help' => t('Storm Expense Date'),
    'field' => array(
      'click sortable' => TRUE,
      'handler' => 'views_handler_field_date',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );
  
  $data['stormexpense']['amount'] = array(
    'title' => t('Amount'),
    'help' => t('Storm Expense Amount'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  
  $data['stormexpense']['tax'] = array(
    'title' => t('Tax'),
    'help' => t('Storm Expense Tax'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  
  $data['stormexpense']['total'] = array(
    'title' => t('Total'),
    'help' => t('Storm Expense Total'),
    'field' => array(
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  
  return $data;
}

function stormexpense_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'stormattribute'),
    ),
    'handlers' => array(
      'stormattribute_handler_filter_attributes_domain' => array(
        'parent' => 'views_handler_filter_in_operator',
    ),
    ),
  );
}
